import React from "react";

class App extends React.Component {
  constructor(props) {
    super(props);
    this.h1Reft = React.createRef();
  }

  render() {
    const el = (
      <h1 className="hello" key={"我是key属性的值"} ref={this.h1Reft}>
        Hello JSX
      </h1>
    );
    console.log("React元素", typeof el, el);
    return (
      <div>
        {el}
        <button onClick={() => console.log(this.h1Reft.current.innerHTML)}>
          点我
        </button>
      </div>
    );
  }
}

export default App;
